package com.lhwl.it.util;

import java.util.ArrayList;   
import java.util.List;

public class PageBean {  
	
    private int pagesize=20;//分页大小    
    private int pagecount=1;//总页数   
    private int rowscount=0;//记录行数    
    private int page=1;//当前页号
    private int offset=0;//起始记录行数
    private List list;   

    public PageBean() {
    }

    public PageBean(int page) {
    	this.page=page;
    }
    
    public PageBean(int page,int pagesize) {
    	this.page=page;
    	this.pagesize=pagesize;
    }
    
    public void inst() {
    	int pcountm=rowscount%pagesize;
    	if (pcountm==0) {
    		pagecount=rowscount/pagesize;
    	} else {
    		pagecount=rowscount/pagesize+1;
    	}
    	
    	if (pagecount==0) {
    		pagecount=1;
    	}
    	
    	if (page<1) {
    		page=1;
    	}
    	
    	if (page>pagecount) {
    		page=pagecount;
    	}
    }
    
    
    public int getPage() {   
        return page;   
    }   
    public void setPage(int page) {   
        this.page = page;   
    }   
    public List getList() {   
        return list;   
    }   
    public void setList(List list) {   
        this.list = list;   
    }   
    public int getPagecount() {   
        return pagecount;   
    }   
    public void setPagecount(int pagecount) {   
        this.pagecount = pagecount;   
    }   
    public int getPagesize() {   
        return pagesize;   
    }   
    public void setPagesize(int pagesize) {   
        this.pagesize = pagesize;   
    }   
    public int getRowscount() {   
        return rowscount;   
    }   
    public void setRowscount(int rowscount) {   
        this.rowscount = rowscount;   
    }   
    
    public int getOffset() {   
        if (page<1) {
        	page=1;
        }
        return (page-1)*pagesize;
    }   
    
}   
